
#pragma once

using namespace System::Collections::Generic;

namespace ttg_internal
{
	namespace utils
	{
		///<summary>
		/// Contains information about record (in UtilManager menu).
		///<summary>
		public ref class ActionMenuRecord
		{
			private:
				System::String ^_name;
				System::Drawing::Image ^_image;
				System::EventHandler ^_handler;
				List<ActionMenuRecord ^> ^_childs;
			internal:
				///<summary>
				/// Returns list with all childs.
				/// Never returns nullptr.
				///</summary>
				property List<ActionMenuRecord ^> ^Childs
				{
					List<ActionMenuRecord ^> ^get()
					{ return _childs; }
				}
			public:
				///<summary>
				/// Creates empty record.
				///<summary>
				ActionMenuRecord(System::String ^name, System::Drawing::Image ^image)
				{
					_name = name;
					_image = image;
					_handler = nullptr;
					_childs = gcnew List<ActionMenuRecord ^>();
				}
				///<summary>
				/// Returns name of the record (for user).
				///<summary>
				property System::String ^Name
				{
					System::String ^get()
					{ return _name; }
				}
				///<summary>
				///Returns icon for record (or nullptr).
				///<summary>
				property System::Drawing::Image ^Image
				{
					System::Drawing::Image ^get()
					{ return _image; }
				}
				///<summary>
				/// Gets or sets handler for onClick event.
				/// Note: it will be used only for non-filter record.
				///<summary>
				property System::EventHandler ^Handler
				{
					System::EventHandler ^get()
					{ return _handler; }
					void set(System::EventHandler ^value)
					{ _handler = value; }
				}
				///<summary>
				/// Creates child for current filter-record.
				///<summary>
				ActionMenuRecord ^CreateChild(System::String ^name, System::Drawing::Image ^image)
				{
					ActionMenuRecord ^res = gcnew ActionMenuRecord(name, image);
					_childs->Add(res);
					return res;
				}
		};
	}
}